<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>box-sizing</title>
</head>
<style>
    div {
    width: 160px;
    height: 80px;
    padding: 20px;
    border: 8px solid red;
    background: yellow;
    margin: 10px;
    }

    .content-box {
    box-sizing: content-box; /** 标准模型 */
    /* Total width: 160px + (2 * 20px) + (2 * 8px) = 216px
        Total height: 80px + (2 * 20px) + (2 * 8px) = 136px
        Content box width: 160px
        Content box height: 80px */
    }

    .border-box {
    box-sizing: border-box; /** IE模型 */
    /* Total width: 160px
        Total height: 80px
        Content box width: 160px - (2 * 20px) - (2 * 8px) = 104px
        Content box height: 80px - (2 * 20px) - (2 * 8px) = 24px */
    }
</style>
<body>
    <div class="content-box">content-box 标准模型</div>
    <div class="border-box">border-box IE模型</div>
    <div class="inherit">inherit 继承父元素</div>
</body>
</html>